<?php
namespace app\shop\model;
use app\BaseModel;
use think\facade\Db;



class WholesaleOrder extends BaseModel
{
    //定义表名
    protected $name = 'longbing_card_shop_order_wholesale';


    /**
     * @author chenniang
     * @DataTime: 2021-02-01 15:05
     * @功能说明:
     */
    public function DoDiscount($discount_data,$order_goods_id){

        if(!empty($discount_data['sale_id'])){

            $sale_id = $discount_data['sale_id'];

            $sale_model = new Wholesale();

            $data = $sale_model->dataInfo(['id'=>$sale_id]);

            $insert = [

                'uniacid' => $data['uniacid'],

                'order_goods_id' => $order_goods_id,

                'min'     => $data['min'],

                'max'     => $data['max'],

                'discount'=> $data['discount'],

                'wholesale_id'=> $data['id'],
            ];

            $res = $this->insert($insert);

            return $res;
        }


    }









}